![]() |
PBExchangeFilesAsync |
||||
Header: | Files.h | Carbon status: | Supported | |
Exchanges the data stored in two files on the same volume.
OSErr PBExchangeFilesAsync ( HParmBlkPtr paramBlock );
A pointer to a basic HFS parameter block.
A result code.
The relevant fields of the parameter block are:
On input, a pointer to a completion function.
On output, the result code of the function.
On input, a pointer to a pathname.
On input, a volume specification.
On input, a pointer to the name of the destination file.
On input, the destination file’s parent directory ID.
On input, the source file’s parent directory ID.
The PBExchangeFilesAsync function swaps the data in two files by changing some of the information in the volume catalog and, if the files are open, in the file control blocks. The PBExchangeFilesAsync function uses the file ID parameter block.
You should use PBExchangeFilesAsync to preserve the file ID when updating an existing file, in case the file is being tracked through its file ID.
Typically, you use PBExchangeFilesAsync after creating a new file during a safe save. You identify the names and parent directory IDs of the two files to be exchanged in the fields ioNamePtr, ioDestNamePtr, ioSrcDirID, and ioDestDirID. The PBExchangeFilesAsync function changes the fields in the catalog entries that record the location of the data and the modification dates. It swaps both the data forks and the resource forks.
The PBExchangeFilesAsync function works on either open or closed files. If either file is open, PBExchangeFilesAsync updates any file control blocks associated with the file. Exchanging the contents of two files requires essentially the same access privileges as opening both files for writing.
The PBExchangeFilesAsync function does not require that file ID references exist for the files being exchanged.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)